//
//  LiaoTianViewLieBiao.swift
//  RoundCatPlay2
//
//  Created by 姜澎 on 2019/10/31.
//  Copyright © 2019 jiangpeng. All rights reserved.
//

import UIKit

class LiaoTianLieBiaoTopView: UIView {
    
    public lazy var titleImage:UIImageView = {
        let i = UIImageView()
        i.image = UIImage(named: "1")
        return i
    }()
    
    public lazy var time: UILabel = {
        let l = UILabel()
        l.font = UIFont.systemFont(ofSize: 16)
        l.text = "12元/小时"
        return l
    }()
    
    public lazy var titleOne: UILabel = {
        let l = UILabel()
        l.font = UIFont.systemFont(ofSize: 14)
        l.textColor = UIColor(red: 151.0 / 255.0, green: 151.0 / 255.0, blue: 151.0 / 255.0, alpha: 1.0)
        l.text = "王者荣耀"
        return l
    }()
    
    public lazy var titleTwo: UILabel = {
        let l = UILabel()
        l.font = UIFont.systemFont(ofSize: 12)
        l.textColor = UIColor(red: 151.0 / 255.0, green: 151.0 / 255.0, blue: 151.0 / 255.0, alpha: 1.0)
        l.text = "下单前聊聊"
        return l
    }()
    
    
    private lazy var liJiBtu: UIButton = {
        let btu = UIButton(type: .custom)
        btu.setBackgroundImage(UIImage(named: "圆角矩形10"), for: .normal)
        btu.setBackgroundImage(UIImage(named: "圆角矩形10"), for: .highlighted)
        btu.setTitle("立即下单", for: .normal)
        btu.setTitle("立即下单", for: .highlighted)
        btu.setTitleColor(UIColor.white, for: .normal)
        btu.setTitleColor(UIColor.white, for: .highlighted)
        btu.titleLabel?.font = UIFont.systemFont(ofSize: 14)
        return btu
    }()

    override init(frame: CGRect) {
        super.init(frame: frame)
        setUI()
    }
    
    
    
    required init?(coder aDecoder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
    
    
    
}

extension LiaoTianLieBiaoTopView {
    func setUI(){
        addSubview(titleImage)
        addSubview(time)
        addSubview(titleOne)
        addSubview(titleTwo)
        addSubview(liJiBtu)
        
        setTitleImageFrame()
        setTimeFrame()
        setTitleOneFrame()
        setTitleTwoFrame()
        setLijiBtuFrame()
    }
    
    func setTitleImageFrame(){
        self.titleImage.snp.makeConstraints { (make) in
            make.top.equalTo(15)
            make.left.equalTo(15)
            make.bottom.equalTo(-20)
            make.width.equalTo(55)
        }
    }
    
    func setTimeFrame() {
        self.time.snp.makeConstraints { (make) in
            make.top.equalTo(15)
            make.left.equalTo(titleImage.snp_right).offset(15)
        }
    }
    
    func setTitleOneFrame() {
        self.titleOne.snp.makeConstraints { (make) in
            make.top.equalTo(time.snp_bottom).offset(10)
            make.left.equalTo(time.snp_left)
        }
    }
    
    func  setTitleTwoFrame() {
        self.titleTwo.snp.makeConstraints { (make) in
            make.top.equalTo(titleOne.snp_bottom).offset(10)
            make.left.equalTo(titleOne.snp_left)
        }
    }
    
    func setLijiBtuFrame() {
        self.liJiBtu.snp.makeConstraints { (make) in
            make.top.equalTo(29)
            make.right.equalTo(-14)
            make.bottom.equalTo(-29)
            make.width.equalTo(80)
        }
    }
}


